<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>广告列表</title>
</head>
<body class="pos-r">

<!-- <div class="ui-loading-block" id="loading">
    <div class="ui-loading-cnt">
        <i class="ui-loading-bright"></i>
        <p>正在加载中...</p>
    </div>
</div> -->

<div >
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> <a _href="welcome.html" class="fun-toindex" href="javascript:;">首页</a> 
		<span class="c-gray en">&gt;</span>广告管理
		<span class="c-gray en">&gt;</span> 广告列表 
		<a class="btn btn-success radius r mr-20 reload" style="line-height:1.6em;margin-top:3px" href="javascript:;" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
		<span class="r" style="margin-top: -2px; box-sizing: border-box;">
			<!-- <select name="cid1" id="cid1" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">全部分类</option>
			</select>

			<select name="cid2" id="cid2" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">全部分类</option>
			</select>

			<select name="flag" id="flag" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">状态</option>
				<option value="0">关闭</option>
				<option value="1">开启</option>
			</select>

			<select name="is_group" id="is_group" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">团购</option>
				<option value="1">是</option>
				<option value="0">否</option>
			</select>

			<select name="is_new" id="is_new" class="select" style="width: auto; height: 31px; vertical-align: middle;">
				<option value="" selected="">新品</option>
				<option value="1">是</option>
				<option value="0">否</option>
			</select>

			<span style="position:relative">
				<input type="text" name="k" id="search-input" placeholder=" 产品名称" style="width:250px" class="input-text">
				<i class="Hui-iconfont i-close" id="inputclear">&#xe706;</i>
			</span>

			<button name="" id="search" class="btn btn-success"><i class="Hui-iconfont">&#xe665;</i> 搜索</button> -->
		</span>
	</nav>
		
		
	<div class="pd-10">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c sort0">
					<th width="40" class="valueid"><input name="" type="checkbox" value=""></th>
					<th width="40" class="fun-sort2" data-name="ad_goods_id" data-flag="0">ID</th>
					<th>商品名称</th>

					<th width="60">主题图片</th>

					<th width="60">价格</th>

					<th width="60">点击量</th>
					<th width="150" class="fun-sort2" data-name="goods_addtime" data-flag="0">发布时间</th>
					<th width="80">是否上架</th>

					<th width="60">操作</th>
				</tr>
			</thead>
			<tbody id="content_sp">
			  
			</tbody>
		</table>	
	</div>

	<div class="cl pd-5 bg-1 bk-gray mt-20 mb-20"> 
		<a href="javascript:;" class="btn btn-warning l mr-10 mt-5 radius fun-all" data-type="stop"><i class="Hui-iconfont">&#xe6de;</i> 批量关闭</a> 
		<a href="javascript:;" class="btn btn-success l mr-10 mt-5 radius fun-all" data-type="start"><i class="Hui-iconfont">&#xe603;</i> 批量开启</a> 
		<a href="javascript:;" class="btn btn-danger l mr-10 mt-5 radius fun-all" data-type="del"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> 
		<!-- <a href="ad-product-add.html" class="btn btn-warning l mr-10 mt-5 radius"><i class="Hui-iconfont">&#xe6de;</i> 添加商品</a>  -->

		<a style="text-decoration:none" onClick="_open('添加商品','ad-product-add.html','90%','80%',true)" class="btn btn-warning l mr-10 mt-5 radius" href="javascript:;" title="添加商品">添加商品</a> 


		<span class="r pt-5"  style="line-height: 35px;" id="page"></span>
		<span class="r mr-10"  style="line-height: 40px;" id="dataall"></span>  
	</div>
		
</div>
</div>

<!-- 商品列表模版 -->
<script id="test" type="text/html">
  	<% for (x in list) { %>
	<tr class="text-c va-m sort1">
		<td class="valueid"><input name="" type="checkbox" value="<%=list[x].ad_goods_id%>"></td>
		<td><%=list[x].ad_goods_id%></td>
		<td class="text-l fun-search" data-name="k" data-value="<%=list[x].goods_name%>"><%=list[x].goods_name%></td>

		
		<td class="text-l" style=" cursor: pointer;" onClick="_open('图片预览','images-view.html?id=<%=list[x].ad_goods_id%>','90%','80%',true)" >
			<img class="pic-thumb" src="/Manage/images/blank.gif" data-lazy="<%=list[x].goods_image%>">
			
		</td>
		<td><%=list[x].goods_quan%>券</td>

		<td><%=list[x].goods_num%></td>

		
		<td class="text-l"><%=list[x].ad_addtime%></td>
		
		
		<td class="td-status">

				<input type="checkbox" class="switch fun-start-stop" style="outline: none;" <%if(list[x].is_show==1){ %>checked<% }%> />
		</td>

		
		<td class="td-manage f-18">	 
			<!-- <a style="text-decoration:none" class="ml-5 fun-del" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a> -->
			<a style="text-decoration:none" onClick="_open('商品编辑','ad-product-add.html?editid=<%=list[x].ad_goods_id%>','90%','80%',true)" class="ml-5 edit" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a> 
			<a style="text-decoration:none" class="ml-5 fun-del" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>
		</td>
	</tr>
	<%}%>  
</script> 
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 
<script type="text/javascript" src="js/template-native.js"></script> 
<script type="text/javascript" src="js/s.js"></script> 


<script type="text/javascript" src="lib/laypage/laypage.js"></script> 
<script src="/Manage/js/lazyload.min.js"></script>
<script type="text/javascript">
var API=API_PRODUCTAD;
var kk=API_PRODUCTAD;//用于搜索和上下翻页
var orderby='';
var search='';

loaddata(API,1,true);



$(document).ready(function(){ 
	// 物流公司
    // for(var i in shippinglist){
    //     $("#shipping_name").append('<option value="'+shippinglist[i]+'">'+shippinglist[i]+'</option>');   
    // }

    // 商品操作、审核/确认收货
	// $(document).on('click','span.pagefun-shenhe',function(){
	//     var id=$(this).parent().parent().find("td.valueid:first-child input").val();
	//     var that=$(this);
	//     var flag=that.data("flag");
	//     $.getJSON(API_GOODS,{pending:id,t1:flag},function(data){
	//     	checkStatus(data);
	//         if(data.status==1){
	//         	if(flag==1){
	//         		that.parent().html("审核通过");     
	//         	}else if(flag==0){
	//         		that.parent().html("<span style='color:#c62b26'>审核不通过</span>");  
	//         	}else if(flag==4){
	//         		that.parent().html("已确认收货");
	//         	}
	        	
 //            }
	//     });  
	// })

	


    // 筛选列表
    var gc;
    $.getJSON(API_GOODSCLASS,function(data){
    	if(!checkStatus(data)) return;

    	gc=data.datas;
        if(data==''){
        	layer.msg('分类出错', {icon:5,time:1000});
        }else{
        	// 罗列一级分类
        	for(i=0; i<data.datas.length; i++){
        		$("#cid1").append("<option value='"+data.datas[i].gc_id+"' data-flag='"+i+"'>"+data.datas[i].gc_name+"</option>");
        	}
        	//二级菜单联动
        	$("#cid1").change(function () {
        		// var ii=$(this).val();
        		var tt=$("#cid1").val();
        		if(tt==""){
        			$("#cid2").html('<option value="" selected="">全部分类</option>');
        		}else{
	        		var ii=$('#cid1 option:selected').data("flag");
	        		if(gc[ii]['child']){
	        			var data2=gc[ii]['child'];
	        		}else{
	        			var data2=[];	        			
	        		}
	        			$("#cid2").empty();
	        			$("#cid2").append("<option value='0' >全部分类</option>");
	        		for(j=0; j<data2.length; j++){
		        		$("#cid2").append("<option value='"+data2[j].gc_id+"' >"+data2[j].gc_name+"</option>");
		        	}
        		}
        		
        	});
        } 	
    });


	$("#search").click(function(){
		kk=API+"?";
		var param=[
			'k='+encodeURI(document.querySelector('input[name=k]').value),
			'cid1='+document.querySelector('select[name=cid1]').value,
			'cid2='+document.querySelector('select[name=cid2]').value,
			't='+document.querySelector('select[name=flag]').value,
			'is_group='+document.querySelector('select[name=is_group]').value,
			'is_new='+document.querySelector('select[name=is_new]').value,


			// 'num='+encodeURI(document.querySelector('input[name=shipping_num]').value),
			// 'name='+document.querySelector('select[name=shipping_name]').value,
		];
		search=param.join('&');
	    kk=kk+search+'&'+orderby;
		loaddata(kk,1);
	})

	$(document).on('click','td.searchstore',function(){
		var storeid=$(this).data("storeid");
		kk=API+"?sid="+storeid;
		loaddata(kk,1,true);	
	})


	

   
	
    
})





		



</script>
</body>
</html>